NAME=mpd-controller
VERSION=2.0
TARGET=$(NAME)_$(VERSION).plasmoid
SRC=contents/code

PYSRC=$(wildcard $(SRC)/*.py)
UISRC=$(wildcard $(SRC)/*.ui)
ICONS=$(wildcard $(SRC)/icons/*.svg)
OBJFILES=$(PYSRC) $(UISRC) $(PYSRC:.py=.pyc) $(UISRC:.ui=_ui.pyc) $(ICONS:.svg=.png)

$(TARGET): $(PYSRC) $(UISRC) $(ICONS) metadata.desktop
	cd $(SRC) && $(MAKE)
	rm -f $@
	zip -rp $@ $(OBJFILES) metadata.desktop

install: $(TARGET)
	plasmapkg -u $?

run: install
	plasmoidviewer $(NAME)

clean:
	find . -name "*.pyc" -print -exec rm '{}' ';'
	find . -name "*~" -print -exec rm '{}' ';'
	rm -f $(TARGET)
